package com.groupseven.happycampus.common.instener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.groupseven.happycampus.common.bo.ParttimeHourBo;
import com.groupseven.happycampus.common.pojo.Parttimehour;
import com.groupseven.happycampus.service.ParttimeHourService;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @CreateTime: 2022-07-23  11:02
 */
@Component
@Scope("prototype")

public class WebParttimeHourListener extends AnalysisEventListener<ParttimeHourBo> {
    @Autowired
    ParttimeHourService parttimeHourService;

    @Override
    public void invoke(ParttimeHourBo parttimeHourBo, AnalysisContext analysisContext) {
        System.out.println(parttimeHourBo);
        Parttimehour parttimeHour = new Parttimehour();
        BeanUtils.copyProperties(parttimeHourBo, parttimeHour);
        parttimeHourService.insertParttimeHour(parttimeHour);

    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
